package com.chenkun.dao;

import com.chenkun.model.Article;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by chenkun on 2017/5/8.
 */
@Mapper
public interface ArticleDao {

    @Insert("insert into t_article values(uuid(),#{title},#{content},#{assess},#{target},#{type})")
    public int add(Article article);

    @Delete("delete from t_article where code = #{code}")
    public int delete(String code);

    @Update("update t_article set title = #{title},content = #{content},#{assess},target = #{target},type = #{type} where code = #{code}")
    public int update(Article article);

    @Select("select *  from t_article where code = #{code}")
    public Article getByCode(String code);

    @Select("select * from t_article")
    public List<Article> getAll();
}
